package com.apes.scm.masterdata.frame.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.Name;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @BelongsProject: apes-server
 * @BelongsPackage: com.apes.scm.masterdata.frame.model
 * @ClassName: StationEntry
 * @Author: pyb
 * @CreateTime: 2020-04-13 14:43
 * @Description: 工位入驻
 * @Version: 1.0
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = StationEntry.CONST_TABLE_NAME)
public class StationEntry extends Model {
    public static final String CONST_TABLE_NAME = "mas_station_entry";

    @Id
    @Column(name = "id", length = 30)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "服务工位")
    @Comment("编码")
    private String id;  //编码

    @ManyToOne
    @JoinColumn(name = "store_id", referencedColumnName="id")
    private BranchEntry store; //门店信息

    @Name
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "station_type", referencedColumnName = "id")
    private Enumeration stationType; //工位类型


    @Column(name = "work_num")
    @Comment("工位数")
    private int workNum;  //工位数

    @Column(name = "area", length = 120)
    @Comment("工位面积")
    private double area;  //工位面积

    @Column(name = "note", length = 250)
    @Comment("备注")
    private String note; //备注
}
